package org.example.controller.bi;

import jakarta.annotation.Resource;
import org.example.domain.Result;
import org.example.domain.bi.DataTypes;
import org.example.mapper.DataTypesMapper;
import org.springframework.web.bind.annotation.*;

/**
 * @description:
 * @Author: whopxx
 * @CreateTime: 2025-01-06
 */
@RestController
@RequestMapping("/dataTypes")
public class DataTypesController {
    @Resource
    private DataTypesMapper dataTypesMapper;

    @GetMapping("/list")
    public Result list() {
        return Result.success(dataTypesMapper.selectList(null));
    }

    @PostMapping
    public Result add(@RequestBody DataTypes dataTypes) {
        dataTypesMapper.insert(dataTypes);
        return Result.success();
    }


    @PutMapping
    public Result update(@RequestBody DataTypes dataTypes) {
        dataTypesMapper.updateById(dataTypes);
        return Result.success();
    }

    @DeleteMapping
    public Result delete(@RequestParam Integer id) {
        dataTypesMapper.deleteById(id);
        return Result.success();
    }
}
